<template>
  <div id="CheckRights">
    <div class="title">
        <img src="../../assets/AIGCDetail/icon2.png" alt="icon">
        <span>推荐互选</span>
    </div>
    <div class="show">        
        <ul>
            <li class="list-data">
                <template>
                    <el-table  :data="tableData" style="width: 100%" :header-cell-style="{'background-color': '#CECECE','color':'#101010','font-size':'13px'}">
                        <el-table-column prop="complainant" label="请求人"   align="center">
                        </el-table-column>
                        <el-table-column prop="caddress" label="推荐对象"   align="center" show-overflow-tooltip="true" >
                        </el-table-column>
                        <el-table-column prop="defendant" label="请求内容"  align="center">
                        </el-table-column>
                        <el-table-column prop="daddress" label="需求"  align="center" show-overflow-tooltip="true" >
                        </el-table-column>
                        <el-table-column prop="daddress" label="是否同意"  align="center" show-overflow-tooltip="true" >
                        </el-table-column>
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <button style="float: left; width:67px;height: 27px;margin-top: 14px; background-color: #00c8c4;color:white;border: none;border-radius: 5px;">查看存证</button>
                                <div style="position: relative; height: 60px;">
                                <button v-if="scope.row.checkState=='审核中'" @click="dialogFormVisible = true" style="position: absolute; top:0;right: 0; width:80px;height: 27px;background-color: #b03124;color:white;border: none;border-radius: 5px;">反馈相似度</button>    
                                <button v-if="scope.row.checkState=='审核中'" @click="function(){scope.row.checkState='审核完成'}" style="position: absolute; top:31px;right: 0; width:80px;height: 27px;background-color: #e99d42;color:white;border: none;border-radius: 5px;">下架作品</button>    
                                <button v-if="scope.row.checkState!='审核中'" @click="function(){scope.row.checkState='审核中'}" style="position: absolute; z-index: 9; top:13px;right: 13px; width:67px;height: 27px;background-color: #bebebe;color:white;border: none;border-radius: 5px;">重新审核</button>    
                                </div>
                            </template>
                        </el-table-column>
                    </el-table> 
                </template>
            </li>
        </ul>
        <div class="block">
            <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page.sync="currentPage3"
                :page-size="100"
                layout="prev, pager, next, jumper"
                :total="1000">
            </el-pagination>
        </div>
    </div>
    <el-dialog :visible.sync="dialogFormVisible">
        <ul class="tan clearfix">
            <li class="biOne">
                <div class="btitle">被侵权作品</div>
                <div class="so">重复词：如果明天会早点到来，如果黑夜不再</div>
                <div class="qu">旋律：活泼</div>
                <div class="btime">上链时间：2021.4.5 12:12:25</div>
            </li>
            <li class="biTwo">
                <div class="btitle">侵权作品</div>
                <div class="so">词重复：如果明天会早点到来，如果黑夜不再</div>
                <div class="qu">旋律：活泼</div>
                <div class="btime">上链时间：2021.5.5 1:12:15</div>
            </li>
            <div class="bend clearfix">
                <div class="fen">
                    <div class="ci">词相似度：80.85%</div>
                    <div class="qu">曲相似度：78.45%</div>
                </div>
                <div class="zo">总体相似率：98.77%</div>
            </div>    
            
        </ul>
        <div slot="footer" class="dialog-footer">
            <el-button type="danger" @click="fankui();dialogFormVisible = false"
            class="bbb" >确认反馈</el-button
            >
            <el-button type="danger" @click="dialogFormVisible = false"
            class="del" >取消</el-button
            >
        </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
    // name:'index',
    data() {
            return {
                tableData: [],
                checkList:[],
                dialogFormVisible: false,
                form: {
                name: "",
                time: "",
                intro: "",
                price: "",
                maxP: "",
                rewordC: ""
            },
            formLabelWidth: "120px",
            fileList: [],
            }
        },
        methods:{
            getAllCorInfo(){
                var url ="http://124.222.205.62:8081/cort/getAllCortInfo"
                console.log(url)
                this.$axios({
                    method: "get",
                    url: url
                })
                .then(response => {
                this.checkList=response.data.data
                console.log(response)
                for (var i =0;i<this.checkList.length;i++){
                    console.log(i)
                    var s = this.checkList[i].checkState
                    if(s){
                        this.checkList[i].checkState='审核完成'                        
                    }
                    else{
                        this.checkList[i].checkState='审核中'
                    }
                    if(s==0){
                        this.checkList[i].id='未知'
                    }
                    else if(s==1){
                        this.checkList[i].id='是'
                    }
                    else{
                        this.checkList[i].id='否'
                    }
                    var flag={
                        complainant: this.checkList[i].complainId,
                        caddress: this.checkList[i].cortedAddress,
                        defendant:this.checkList[i].defendantId,
                        daddress:this.checkList[i].defendantIdAddress,
                        date:this.checkList[i].time.replace("T"," "),
                        state:this.checkList[i].id,
                        checkState: this.checkList[i].checkState
                    }
                    this.tableData.push(flag)
                }
                })
                .catch(function(err) {
                    console.log(err);
                });
            },
            fankui() {
                console.log("反馈成功")
                var url ="http://124.222.205.62:8081/cort/getAllCortInfo"
                console.log(url)
          this.$axios({
            method: "get",
            url: url
          })
            .then(response => {
              console.log(response);
              this.$message.success({
                message: '已成功向用户发送对比报告',
                offset:75
              })
            })
            .catch(function(err) {
              console.log(err);
            });
        },
        },
        mounted(){
            this.getAllCorInfo()
        },
        beforeCreate(){ 
            //   location.reload();
        },
        created(){
            // location.reload();
        }
}
</script>

<style scoped>
    @import '../../style/CheckRights.css';
</style>